﻿//
// Created by francklinson on 2021/3/23.
//

#ifndef CPPPRIMERPLUSREADINGCODES_MYCOMPLEX_H
#define CPPPRIMERPLUSREADINGCODES_MYCOMPLEX_H

#include <iostream>


class MyComplex
{
private:
    double re; // 实部
    double im; // 虚部
public:
    MyComplex(); // 默认构造
    MyComplex(double a, double b); // 参数构造
    MyComplex operator+(const MyComplex &m) const; // 加法重载
    MyComplex operator-(const MyComplex &m) const; // 减法重载
    MyComplex operator*(const MyComplex &m) const; // 乘法重载
    MyComplex operator*(double a) const; // 乘法重载
    MyComplex operator~() const; // 共轭重载
    friend MyComplex operator*(double a, MyComplex &m); // 加法重载

    friend std::ostream &operator<<(std::ostream &os, const MyComplex &m); // <<重载

    friend std::istream &operator>>(std::istream &is, MyComplex &m); // >>重载


};


#endif //CPPPRIMERPLUSREADINGCODES_MYCOMPLEX_H
